package com.eff.android.fragment;

import com.eff.android.EMainActivity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
import android.view.ViewGroup;

public class EBaseFragment extends Fragment{
	
	public EBaseFragment(Bundle arguments){
		if (arguments != null){
		    this.setArguments(arguments);
		}
	}
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

    protected void switchFragment(Fragment f, String tagName) {
		if (getActivity() != null) {
		    ((EMainActivity) getActivity()).setupContentFragment(f, tagName, true);
		}
    }

    @Override
    public void onDestroyView() {
		super.onDestroyView();
		Runtime.getRuntime().gc();
		System.gc();
		View container = getView();
		if (container != null) {
		    ViewGroup group = (ViewGroup) container.getParent();
		    if (group != null) {
			group.removeAllViewsInLayout();
		    }
		}
    }
}
